package com.shuyuansystem.entity;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptors())
                .addPathPatterns("/**")  // 拦截所有接口进行token验证
                .excludePathPatterns("/backend/login.html","/Login/login","/ValidateCode/ValidateCode.do","Login/register","alipay/**"
                ,"/submitOrder"
                ,"/alipay/notify"
                , "/producter"
                ,"/order/**"
                , "/producter/**"
                ,"/BusinessOrder/toProduct"
                ,"/MerchantProduct/getRoleAndUserId"
                ,"/ReviewsController/**"
                ,"/ReviewsController/updateReviews"
                ,"/Login/ChangePassworld"
                );  // 放行登录页面,无需token验证
    }
}